local hx__shibei_gu = fk.CreateSkill {
  name = "hx__shibei_gu",
  tags = { Skill.Compulsory },
}

hx__shibei_gu:addEffect(fk.DamageInflicted, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(hx__shibei_gu.name) then
      return player:getMark("@@hx__shibei_gu-turn") == 0
    end
  end,
  on_use = function(self, event, target, player, data)
    data:preventDamage()
    player.room:addPlayerMark(player, "@@hx__shibei_gu-turn", 1)
  end,
})

hx__shibei_gu:addEffect(fk.Damaged, {
  anim_type = "defensive",
  is_delay_effect = true,
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(hx__shibei_gu.name) then
      return player:getMark("@@hx__shibei_gu-turn") > 0
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:recover{
      who = player,
      num = 1,
      recoverBy = player,
      skillName = hx__shibei_gu.name,
    }
  end,
})

return hx__shibei_gu
